From: Matthias Clasen Date: Thu, 30 Jun 2022 20:13:17 +0000 (-0400) Subject: Add gtk_builder_cscope_add_callback X-Git-Tag: archive/raspbian/4.8.3+ds-2+rpi1~3^2~81^2^2~94^2~4 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=faa9ef2dc02ee8eecd36024ea81e831e0692ba54;p=gtk4.git Add gtk_builder_cscope_add_callback This is a convenience method for the common case that symbols are used under their own name. --- diff --git a/gtk/gtkbuilderscope.c b/gtk/gtkbuilderscope.c index f5503c8b11..6d472dc6a8 100644 --- a/gtk/gtkbuilderscope.c +++ b/gtk/gtkbuilderscope.c @@ -428,6 +428,19 @@ gtk_builder_cscope_new (void) return g_object_new (GTK_TYPE_BUILDER_CSCOPE, NULL); } +/** + * gtk_builder_cscope_add_callback: + * @self: a `GtkBuilderCScope` + * @callback_symbols: (scope async): The callback pointer + * + * Adds the @callback_symbol to the scope of @builder under its + * own name. + * + * This is a convenience wrapper of [method@Gtk.BuilderCScope.add_callback_symbol]. + * + * Since: 4.8 + */ + /** * gtk_builder_cscope_add_callback_symbol: * @self: a `GtkBuilderCScope` diff --git a/gtk/gtkbuilderscope.h b/gtk/gtkbuilderscope.h index 7fc2ccbc0b..5ab602fc06 100644 --- a/gtk/gtkbuilderscope.h +++ b/gtk/gtkbuilderscope.h @@ -114,10 +114,14 @@ GDK_AVAILABLE_IN_ALL void gtk_builder_cscope_add_callback_symbols (GtkBuilderCScope *self, const char *first_callback_name, GCallback first_callback_symbol, - ...) G_GNUC_NULL_TERMINATED; + ...) G_GNUC_NULL_TERMINATED; + +#define gtk_builder_cscope_add_callback(scope, callback) \ + gtk_builder_cscope_add_callback_symbol (GTK_BUILDER_CSCOPE (scope), #callback, G_CALLBACK (callback)) + GDK_AVAILABLE_IN_ALL GCallback gtk_builder_cscope_lookup_callback_symbol(GtkBuilderCScope *self, - const char *callback_name); + const char *callback_name); G_END_DECLS